/*file:gamecore.h
 *
 *
 */

#ifndef _GAMECORE_H_
#define _GAMECORE_H_

#include "card.h"
#include "player.h"
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>

using namespace std;

class GameCore
{
	private:

		Card *load_card(const char *filename);

	public:
        enum PlayerID {
            PLAYER_1,
            PLAYER_2,
        };
        static const int MAX_HANDCARD_NUM = 6;
        Player *player1;
        Player *player2;
        enum PlayerID cur_playerID;
        Player *cur_player;
		//map<string, Card *> cardmap;
        vector<Card *> cardmap;
        Card *handcard_array1[6];
        Card *handcard_array2[6];

        GameCore();
		~GameCore();
		void load_all_cards(const char *path);
        void swap_player();

        bool play_a_card (enum PlayerID p, int index);
        bool discard_a_card (enum PlayerID p, int index);
        bool draw_a_card (enum PlayerID p, int index);
        bool is_card_playable (enum PlayerID p, int index);
        Card *get_card (enum PlayerID p, int index);
        size_t get_handcard_number(enum PlayerID p);

		//for debug
		void print_all_cards ();
};

#endif /*_GAMECORE_H_*/
